<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Block</title>
</head>

<body>
<?php
include("../connection/connection.php");
include("reportFunctions.php");
$distId=$_REQUEST['distId'];
$sqlReport = "SELECT `district_id`,`district_name`,`block_id`,`block_name`,sum(total_population) as total_population FROM `tbl_lookup_location` where `district_id` = ".$distId." group by `block_id`";
$queryReport = mysql_query($sqlReport);

?>

<table border="0" width="800" cellspacing="0" cellpadding="0">
	<tr>
		<td bgcolor="#E9E9E9" height="26">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
		<font face="Verdana" color="#224568">Percent Population served by different type of schemes(as per PHED)</font></span></td>
	</tr>
	<tr>
	  <td bgcolor="#E9E9E9" height="26"><div align="center"><font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#224568">Table 6 </font></div></td>
  </tr>
	<tr>
		<td bgcolor="#E9E9E9" height="56">
		<table border="1" width="800" cellspacing="0" cellpadding="0" height="55" bgcolor="#C5D8EB">
		
			<tr>
				<td width="23" height="53" align="center">
				<p align="center"><font face="Verdana" style="font-size: 8.5pt">
			  S. No.</font></td>
				<td width="98" align="center">
				<font face="Verdana" style="font-size: 8.5pt">Name of the Block </font></td>
				<td width="70" align="center">
				  <p align="center">
			  <font style="font-size: 8.5pt" face="Verdana">Present Population of Block </font></td>
				<td width="63" align="center">
				  <font style="font-size: 8.5pt" face="Verdana">Population Served by Piped Supply </font></td>
				  <td width="63" align="center">
				  <font style="font-size: 8.5pt" face="Verdana">Population Served by P & T Supply </font></td>
				  <td width="77" align="center">
				  <font style="font-size: 8.5pt" face="Verdana">Population Served by Sanitary Diggs Supply </font></td>
				<td width="74" align="center">
			  <p align="center"><font style="font-size: 8.5pt" face="Verdana">Population Served by Hand Pumps </font></td>
			    <td width="76" align="center"><font style="font-size: 8.5pt" face="Verdana">Percent Population served by Piped Supply</font></td>
				<td width="76" align="center"><font style="font-size: 8.5pt" face="Verdana">Percent Population served by P & T Supply</font></td>
				<td width="76" align="center"><font style="font-size: 8.5pt" face="Verdana">Percent Population served by Sanitary Diggs Supply</font></td>
			    <td width="80" align="center"><font style="font-size: 8.5pt" face="Verdana">Percent Population Served by Hand Pumps</font> </td>
			</tr>
		</table>		</td>
	</tr>
	<tr>
		<td>
		<table border="1" width="800" cellspacing="0" cellpadding="0" height="49" bordercolor="#C5D8EB" style="border: 1px solid #BBD1E8" bgcolor="#F9F9F9">
		<?php
		$slNo=1;
		$totBlockPopulation=0;
		$totPipedPopulation=0;
		$totPntPopulation=0;
		$totSanDigPopulation=0;
		$totHpPopulation=0;
		while($rowReport = mysql_fetch_array($queryReport)) {
		$numPopulationPntScheme=getPopulationSchemeBlockWise($distId,'P&T',$rowReport['block_id'])+getPopulationSchemeBlockWise($distId,'TSS(P&T)',$rowReport['block_id']); //+ //getPopulationTankerBlockWise($distId,'',$rowReport['block_id']) ;
		$numPopulationPipedScheme=getPopulationSchemeBlockWise($distId,'Piped',$rowReport['block_id']);
		$numPopulationSanDiggScheme=getPopulationSchemeBlockWise($distId,'Sanitary Diggs',$rowReport['block_id']);
		$numPresentPopulation=getPopulationSchemeBlockWise($distId,'HP',$rowReport['block_id']);
		$numPopulationHpScheme=getPopulationSchemeBlockWise($distId,'HP',$rowReport['block_id']);
		$presentBlockPop=round($rowReport['total_population']*getPopFactorDistWise($distId));
		$percentPopulationPiped=number_format(($numPopulationPipedScheme/$presentBlockPop)*100,2,'.','');
		$percentPopulationPnt=number_format(($numPopulationPntScheme/$presentBlockPop)*100,2,'.','');
		$percentPopulationSanDigg=number_format(($numPopulationSanDiggScheme/$presentBlockPop)*100,2,'.','');
		$percentPopulationHp=number_format(($numPopulationHpScheme/$presentBlockPop)*100,2,'.','');
		
		$totBlockPopulation +=$presentBlockPop;//$rowReport['total_population'];
		$totPipedPopulation +=$numPopulationPipedScheme;
		$totPntPopulation +=$numPopulationPntScheme;
		$totSanDigPopulation +=$numPopulationSanDiggScheme;
		$totHpPopulation +=$numPopulationHpScheme;
			?>
			<tr>
				<td width="24" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php echo $slNo; ?></font></td>
				<td width="96" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php echo $rowReport['block_name']; ?></font></td>
				<td width="69" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php echo $presentBlockPop; //round($rowReport['total_population']*getPopFactorDistWise($distId));?></font></td>
				<td width="66" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php 
				if($numPopulationPipedScheme=='')
				{
					echo $numPopulationPipedScheme=0;
				}
				else
				{
					echo $numPopulationPipedScheme;
				}
				
				?></font></td>
				<td width="62" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php 
				if($numPopulationPntScheme=='')
				{
					echo $numPopulationPntScheme=0;
				}
				else
				{
					echo $numPopulationPntScheme;
				}
				?></font></td>
				<td width="78" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php 
				if($numPopulationSanDiggScheme=='')
				{
					echo $numPopulationSanDiggScheme=0;
				}
				else
				{
					echo $numPopulationSanDiggScheme;
				}
				?></font></td>
				<td width="75" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php 
				if($numPopulationHpScheme=='')
				{
					echo $numPopulationHpScheme=0;
				}
				else
				{
					echo $numPopulationHpScheme;
				}
				
				?></font></td>
			    <td width="75" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php echo $percentPopulationPiped;?> </font></td>
				<td width="78" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php echo $percentPopulationPnt;?> </font></td>
				<td width="74" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php echo $percentPopulationSanDigg;?> </font></td>
			    <td width="79" align="center"><font style="font-size: 8.5pt" face="Verdana"><?php echo $percentPopulationHp;?></font></td>
			</tr>
			
						<?php 
			$slNo++;
			}
			?>
			<tr>
			  <td colspan="2" align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana">Total</font></td>
			  <td align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana"><?php echo $totBlockPopulation;?></font></td>
			  <td align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana"><?php echo $totPipedPopulation;?></font></td>
			  <td align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana"><?php echo $totPntPopulation;?></font></td>
			  <td align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana"><?php echo $totSanDigPopulation;?></font></td>
			  <td align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana"><?php echo $totHpPopulation;?></font></td>
			  <td align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana"><?php echo number_format(($totPipedPopulation/$totBlockPopulation)*100,2,'.','');?></font></td>
			  <td align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana"><?php echo number_format(($totPntPopulation/$totBlockPopulation)*100,2,'.','');?></font></td>
			  <td align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana"><?php echo number_format(($totSanDigPopulation/$totBlockPopulation)*100,2,'.','');?></font></td>
			  <td align="center" bgcolor="#E9E9E9"><font style="font-size: 8.5pt" face="Verdana"><?php echo number_format(($totHpPopulation/$totBlockPopulation)*100,2,'.','');?></font></td>
		  </tr>
		</table>		</td>
	</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>



</body>

</html>
